//--------------------------
// ontology generation and management
function push(a, el) {
  for (var i=0; i < a.length; i++){
    if(a[i].name==el.name) return;
  }
 a[a.length] = el;
}

function splice(arr, i, count) {
  copy = new Array();
  for (k=0; k < arr.length; k++) {
    if (k >= i && k < i+count)
      continue;
    push(copy, arr[k]);
  }
  return copy;
}

function Class( name, label, superClass ) {
    this.name = name;
    this.label = label;
    this.supClass = superClass;
    this.children = new Array();
    if (superClass != null) {
        push(superClass.children, this);
    }

    this.props = new Array();
    this.attribs = new Array();
} // Class


function addProperty( aClass, aProperty ) {
    push(aClass.props,aProperty);
    for (var i=0; i < aClass.children.length; i++)
        addProperty(aClass.children[i], aProperty);
} // addProperty

function addAttribute( aClass, anAttribute ) {
    push(aClass.attribs,anAttribute);

    for (var i=0; i < aClass.children.length; i++)
        addAttribute(aClass.children[i], anAttribute);
} // addAttribute


function addPropertyRange( aProperty, aClass ) {
    push(aProperty.range,aClass);

//    for (var i=0; i < aClass.children.length; i++)
//        addProperty(aClass.children[i], aProperty);
} // addProperty

//------------------------------
// a property with range other than literal

function Property( name, label) {
    this.name = name;
    this.label = label;
    this.children = new Array();
    this.range =  new Array();
//    this.domains = new Array();
} // Class

//------------------------------
// a property with range Literal

function Attribute( name, label) {
    this.name = name;
    this.label = label;
    this.children = new Array();
    this.range =  new Array();
//    this.domains = new Array();
} // Class



